/**
 * 
 */
package fr.mynounou.web.model.dao;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.osgi.service.jpa.EntityManagerFactoryBuilder;

import fr.mynounou.entities.Enfant;
import fr.mynounou.exceptions.dao.ExistingEntityException;
import fr.mynounou.exceptions.dao.NotUniqueException;

/**
 * @author btavernier
 * 
 */
@SuppressWarnings("serial")
@ManagedBean(name = "EnfantDAO")
@ApplicationScoped
public class EnfantDaoImpl extends JpaDAO implements EnfantDao, Serializable {
	private static final String JPA_UNIT_NAME = "MyNounou";

	ArrayList<Enfant> list;

	public EnfantDaoImpl() {
		list = new ArrayList<>();

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see fr.mynounou.web.model.dao.EnfantDao#listEnfants()
	 */
	@Override
	public List<Enfant> listEnfants() {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see fr.mynounou.web.model.dao.EnfantDao#findEnfant(java.lang.String)
	 */
	@Override
	public Enfant findEnfant(Integer id) throws NotUniqueException {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * fr.mynounou.web.model.dao.EnfantDao#saveEnfant(fr.mynounou.entities.Enfant
	 * )
	 */
	@Override
	public Enfant saveEnfant(Enfant u) throws ExistingEntityException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EntityManager getEntityManager() {
		if (em == null) {
			em = Persistence.createEntityManagerFactory(JPA_UNIT_NAME)
					.createEntityManager();
		}
		return em;
	}

}
